﻿#region

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using StockholmsStad.Web.UI.Class.Business;

#endregion

namespace StockholmsStad.Web.UI.Test
{
    /// <summary>
    ///This is a test class for PersonalNumberTest and is intended
    ///to contain all PersonalNumberTest Unit Tests
    ///</summary>
    [TestClass]
    public class PersonalNumberTest
    {
        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        #region Additional test attributes

        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //

        #endregion

        /// <summary>
        ///A test for PersonIdLastNumbers
        ///</summary>
        [TestMethod]
        public void PersonIdLastNumbersTest()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = "0234";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            int? expected = 234;
            int? actual;
            target.PersonIdLastNumbers = expected;
            actual = target.PersonIdLastNumbers;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for PersonIdLastNumbers
        ///</summary>
        [TestMethod]
        public void PersonIdLastNumbersTest2()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = "";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            int? expected = null;
            int? actual;
            target.PersonIdLastNumbers = expected;
            actual = target.PersonIdLastNumbers;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for PersonIdLastNumbers
        ///</summary>
        [TestMethod]
        public void PersonIdLastNumbersTest3()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = null;
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            int? expected = null;
            int? actual;
            target.PersonIdLastNumbers = expected;
            actual = target.PersonIdLastNumbers;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for BirthDate
        ///</summary>
        [TestMethod]
        public void BirthDateTest()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = null;
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            var expected = new DateTime(1970, 1, 1);
            DateTime actual;
            target.BirthDate = expected;
            actual = target.BirthDate;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for GetBirthDateText
        ///</summary>
        [TestMethod]
        public void BirthDateTextTest2()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = null;
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            string expected = birthDate;
            string actual;
            actual = target.BirthDateText;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for IsValid
        ///</summary>
        [TestMethod]
        public void IsValidTest()
        {
            string birthDate = "19700328";
            string personIdLastNumbers = "";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(true, target.IsValid());
        }

        /// <summary>
        ///A test for IsValid
        ///</summary>
        [TestMethod]
        public void IsValidTest7()
        {
            string birthDate = "19700328";
            string personIdLastNumbers = null;
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(true, target.IsValid());
        }

        /// <summary>
        ///A test for IsValid
        ///</summary>
        [TestMethod]
        public void IsValidTest2()
        {
            string birthDate = "19700328";
            string personIdLastNumbers = "0000";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(true, target.IsValid());
        }

        /// <summary>
        ///A test for IsValid
        ///</summary>
        [TestMethod]
        public void IsValidTest3()
        {
            string birthDate = "19700328";
            string personIdLastNumbers = "0539";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(true, target.IsValid());
        }

        /// <summary>
        ///A test for IsValid
        ///</summary>
        [TestMethod]
        public void IsValidTest4()
        {
            string birthDate = "19700328";
            string personIdLastNumbers = "0538";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(false, target.IsValid());
        }

        /// <summary>
        ///A test for IsValid
        ///</summary>
        [TestMethod]
        public void IsValidTest5()
        {
            string birthDate = "19640610";
            string personIdLastNumbers = "0070";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(true, target.IsValid());
        }

        /// <summary>
        ///A test for IsValid
        ///</summary>
        [TestMethod]
        public void IsValidTest6()
        {
            string birthDate = "19640610";
            string personIdLastNumbers = "0060";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(false, target.IsValid());
        }


        /// <summary>
        ///A test for PersonIdLastNumbersText
        ///</summary>
        [TestMethod]
        public void PersonIdLastNumbersTextTest()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = "0234";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            string expected = personIdLastNumbers;
            string actual;
            actual = target.PersonIdLastNumbersText;
            Assert.AreEqual(expected, actual);
        }


        /// <summary>
        ///A test for PersonIdLastNumbersText
        ///</summary>
        [TestMethod]
        public void PersonIdLastNumbersTextTest2()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = null;
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            string expected = "";
            string actual;
            actual = target.PersonIdLastNumbersText;
            Assert.AreEqual(expected, actual);
        }


        /// <summary>
        ///A test for BirthDateText
        ///</summary>
        [TestMethod]
        public void BirthDateTextTest()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = "0234";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            string expected = birthDate;
            string actual;
            actual = target.BirthDateText;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for ToString
        ///</summary>
        [TestMethod]
        public void ToStringTest()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = "0234";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            string expected = birthDate + personIdLastNumbers;
            string actual;
            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for ToString
        ///</summary>
        [TestMethod]
        public void ToStringTest2()
        {
            string birthDate = "19700101";
            var target = new PersonalNumber(new DateTime(1970, 01, 01), null);
            string expected = birthDate;
            string actual;
            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for GetHashCode
        ///</summary>
        [TestMethod]
        public void GetHashCodeTest()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = "0234";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            int actual;
            actual = target.GetHashCode();
            Assert.AreNotEqual(0, actual);
        }

        /// <summary>
        ///A test for GetHashCode
        ///</summary>
        [TestMethod]
        public void GetHashCodeTest2()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = null;
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            int actual;
            actual = target.GetHashCode();
            Assert.AreNotEqual(0, actual);
        }

        /// <summary>
        ///A test for Equals
        ///</summary>
        [TestMethod]
        public void EqualsTest()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = "0234";
            var target1 = new PersonalNumber(birthDate, personIdLastNumbers);
            var target2 = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.IsTrue(target1.Equals(target2));
        }

        /// <summary>
        ///A test for Equals
        ///</summary>
        [TestMethod]
        public void EqualsTest2()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = null;
            var target1 = new PersonalNumber(birthDate, personIdLastNumbers);
            var target2 = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.IsTrue(target1.Equals(target2));
        }

        /// <summary>
        ///A test for PersonalNumber Constructor
        ///</summary>
        [TestMethod]
        public void PersonalNumberConstructorTest()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = "0234";
            string personalNumber = birthDate + personIdLastNumbers;
            var target = new PersonalNumber(personalNumber);
            var expected = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(expected, target);
        }

        /// <summary>
        ///A test for PersonalNumber Constructor
        ///</summary>
        [TestMethod]
        public void PersonalNumberConstructorTest2()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = "0234";
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            var expected = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(expected, target);
        }


        /// <summary>
        ///A test for PersonalNumber Constructor
        ///</summary>
        [TestMethod]
        public void PersonalNumberConstructorTest3()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = "0234";
            string personalNumber = birthDate + personIdLastNumbers;
            var target = new PersonalNumber(new DateTime(1970, 01, 01), 234);
            var expected = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(expected, target);
        }

        /// <summary>
        ///A test for PersonalNumber Constructor
        ///</summary>
        [TestMethod]
        public void PersonalNumberConstructorTest4()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = null;
            string personalNumber = birthDate;
            var target = new PersonalNumber(personalNumber);
            var expected = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(expected, target);
        }

        /// <summary>
        ///A test for PersonalNumber Constructor
        ///</summary>
        [TestMethod]
        public void PersonalNumberConstructorTest5()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = null;
            var target = new PersonalNumber(birthDate, personIdLastNumbers);
            var expected = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(expected, target);
        }


        /// <summary>
        ///A test for PersonalNumber Constructor
        ///</summary>
        [TestMethod]
        public void PersonalNumberConstructorTest6()
        {
            string birthDate = "19700101";
            string personIdLastNumbers = null;
            string personalNumber = birthDate + personIdLastNumbers;
            var target = new PersonalNumber(new DateTime(1970, 01, 01), null);
            var expected = new PersonalNumber(birthDate, personIdLastNumbers);
            Assert.AreEqual(expected, target);
        }
    }
}